﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BusinessModel.EntityModel;

namespace BusinessModel
{
    public class InfoHelper
    {
        public string AddNewsType(NewsType nt)
        {
            EntityOprHelper eoHelper = new EntityOprHelper();
            NewsType news=eoHelper.GetEntity<NewsType>(nt.newstypecode);
            if (news != null)
                return "信息类型编码已存在！";
            bool flag=eoHelper.AddEntity<NewsType>(nt);
            if (!flag)
                return "添加失败！";
            return "";
        }

        public string EditNewsType(NewsType nt)
        {
            EntityOprHelper eoHelper = new EntityOprHelper();
            NewsType news = eoHelper.GetEntity<NewsType>(nt.newstypecode);
            if (news == null)
                return "该记录已不存在！";
            bool flag = eoHelper.EditEntity<NewsType>(nt);
            if (!flag)
                return "修改失败！";
            return "";
        }
    }
}
